package util.core;

import net.sf.cglib.proxy.Enhancer;
import util.cache.CacheInterceptor;

/**
 * Created by WhiteBlue on 15/5/6.
 */
public class DaoFactory {

    public static <T> T getDao(Class<T> obj) {

        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(obj);

        enhancer.setCallback(new CacheInterceptor());//添加缓存AOP

        return (T) enhancer.create();
    }
}
